/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.asseco.mio.codex.controllers;

import com.asseco.mio.codex.City;
import org.appfuse.service.GenericManager;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;


/**
 *
 * @author gjoko.mitrovski
 */
@Controller
@RequestMapping("/cities*")
public class CityController {
 private GenericManager<City, String> cityManager;

    @Autowired
    public void setCityManager(@Qualifier("cityManager") GenericManager<City, String> cityManager) {
        this.cityManager = cityManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest()
    throws Exception {

        return new ModelAndView().addObject(cityManager.getAll());
    }
}
